import javax.swing.*; 
import javax.swing.event.*; 

import java.awt.Desktop;
import java.io.*; 
 
public class JBrowser extends JEditorPane implements HyperlinkListener 
{ 

	private static final long serialVersionUID = 1L;

JBrowser() 
  { 
    setEditable( false ); 
    addHyperlinkListener( this );
  } 
 
  @Override public void hyperlinkUpdate( HyperlinkEvent event ) 
  { 
    HyperlinkEvent.EventType typ = event.getEventType(); 
 
    if ( typ == HyperlinkEvent.EventType.ACTIVATED ) 
    { 
      try 
      { 
        Desktop.getDesktop().browse(event.getURL().toURI());
      } 
      catch( IOException e ) { 
        JOptionPane.showMessageDialog( this, 
                                      "Kann dem Link nicht folgen: " 
                                      + event.getURL().toExternalForm(), 
                                      "Ladefehler", 
                                      JOptionPane.ERROR_MESSAGE ); 
      }catch(Exception e){
    	  System.out.println("URI FEHLER");
      }
    } 
  } 
}